Method for measuring objects in digestive tract based on imaging system

ABSTRACT

A method for measuring objects in digestive tract based on an imaging system is provided. The imaging system enters a calibration stage, and obtains a calibration image. A measurement stage enters, and the imaging system places in the digestive tract to capture at least one detection image. The depth distance zi from each pixel in the detection image to the imaging system is calculated, and it records as a depth image z(x, y). The scale r of each pixel in the detection image is calculated according to the depth image z(x, y). The actual two-dimensional coordinates Si′ of each pixel point in the detection image are calculated by the scale r, and the actual three-dimensional coordinates (Si′, z(x, y)) of each pixel are obtained. The distance between any two pixels in the detection image or the area within any range is calculated.

CROSS-REFERENCE OF RELATED APPLICATIONS

The application claims priority to Chinese Patent Application No.201910347966.5 filed on Apr. 28, 2019, the contents of which areincorporated by reference herein.

FIELD OF INVENTION

The present invention relates to image processing, and more particularlyto a method for measuring objects in digestive tract based on an imagingsystem.

BACKGROUND

At present, capsule endoscopes have become increasingly popular fordigestive tract examination. Doctors examine subjects through imagestaken by the capsule endoscopes inside the digestive tract of thesubjects. However, for a normal capsule endoscope, when a captured imageshows a lesion, the doctor can only determine through the shape, color,position and other characteristics of the lesion, but cannot obtain thesize information of the lesion, and therefore cannot give an accuratequantitative analysis result.

In the prior art, for example, according to a Chinese Patent No.CN107072498A, a method for distance measuring in the digestive tract isprovided. In the above method, some distance measuring pixels aredistributed in a common image sensor to generate distance measuring datafor object depth information, that is depth image. Then, the distancemeasuring data of known pixel positions is used to interpolate the depthof the pixel position of the distance measuring data not derived in thedepth image. In the above method, the calculation method is complicated,and the requirements on components are high. The distance measuringpixels need to be evenly distributed in the image sensor, and moremeasurement points are required. If there are a plurality of measurementpoints, a large deviation can appear in subsequent gradientcalculations, which can eventually cause measurement distortion.

According to a Chinese Patent No. CN101902961A, a device, system andmethod for estimating the size of an object in a body lumen is provided.In the above method, a laser device is configured in the capsuleendoscope, and distance measurement and object measurement are performedby laser points and image brightness. However, the effect of media inthe digestive tract is ignored in the method. The environment of thedigestive tract is complex. Both air and digestive fluid can affect theoptical path of laser and directly affect the result of laser distancemeasuring. In addition, the distance measurement can always depend onthe results of laser distance measuring. Each measurement requires laserdistance measuring, and a plurality of calculations are required at eachtime of measurement, which consumes manpower and material resources.

Therefore, it is necessary to design a new method for measuring objectsin the digestive tract.

SUMMARY OF THE INVENTION

To solve one of the above problems, the present invention provides amethod for measuring objects in digestive tract based on an imagingsystem, comprising: simulating an environment of the digestive tract andentering a calibration stage of the imaging system;

controlling the imaging system to photograph at different positions toobtain a calibration image;

calculating and determining the relationship between the brightness coof any pixel in the calibration image and the depth distance z from theactual position of the pixel in the simulated digestive tract to theimaging system, and recording it as:z(x,y)=g(φ(x,y))  (1);

calculating and determining the relationship between the scale r of anypixel in the calibration image and the depth distance z from the actualposition of the pixel in the simulated digestive tract to the imagingsystem, wherein scale is the actual length represented by unit pixel inthe calibration image, and recording it as:r=dz  (2);

entering a measurement stage after calibration is completed;

placing the imaging system in the digestive tract;

capturing and obtaining at least one detection image;

obtaining the brightness of each pixel in the detection image;

calculating the depth distance z_(i) from each pixel in the detectionimage to the imaging system according to equation 1, and recording it asa depth image z(x, y); calculating the scale r of each pixel in thedetection image according to equation 2 and the depth image z(x, y);

obtaining the pixel coordinates S_(i) of each pixel point in thedetection image, and calculating the actual two-dimensional coordinatesS_(i)′ of each pixel point in the detection image by the scale r;

integrating to obtain the actual three-dimensional coordinates (S_(i)′,z(x, y)) of each pixel;

calculating or measuring the distance between any two pixels in thedetection image or the area within any range.

In an embodiment, the step “capturing and obtaining at least onedetection image” further comprises:

obtaining at least one reference point P in at least one detectionimage, and recording the actual position of the reference point P in thedigestive tract as a target point P′; and

wherein the step “calculating the depth distance z_(i) from each pixelin the detection image to the imaging system according to equation 1”further comprises:

calculating the pixel coordinates P_(i) of the reference point Pseparately;

calculating the depth distance z_(i) from the target point P′ to theimaging system separately;

obtaining the predicted brightness g⁻¹(z_(i)) of the reference point Pin the detection image according to equation 1 and the depth distancez_(i);

comparing the predicted brightness g⁻¹ (z_(i)) of the reference point Pwith the actual pixel brightness img(P_(i)) of the reference point P toobtain a correction factor k_(i), and recording it as:

$\begin{matrix}{{k_{i} = \frac{g^{- 1}\left( z_{i} \right)}{{img}\left( P_{i} \right)}};} & (3)\end{matrix}$

obtaining the mean value k of the correction factors k_(i) of allreference points P; calibrating the pixels in the detection image withthe mean value k of correction factors to obtain the depth distance fromeach pixel to the imaging system, and recording it as the depth imagez(x, y), where:z(x,y)=g( kimg(x,y))  (4).

In an embodiment, the digestive tract comprises a plurality of regionsand the imaging system comprises a plurality of exposure levels; andwherein, after the step “obtaining the mean value k of the correctionfactors k_(i) of all reference points P”, the mean value k of thecorrection factors is stored according to different exposure levels anddifferent digestive tract regions.

In an embodiment, after two or more mean values k of correction factorsare obtained at the same exposure level and digestive tract region, theaverage of the mean values k of correction factors is calculated beforestoring and updating.

In an embodiment, the step “obtaining at least one reference point P inat least one detection image” comprises:

obtaining a light spot formed in a detection image;

calculating the center of the light spot, and recording the center ofthe light spot as a reference point P, and recording the pixel distancefrom the reference point P to the image center of the detection image asa reference distance Δp.

In one embodiment, the calibration stage further comprises:

obtaining a light spot in the simulated digestive tract;

calculating the center of the light spot and recording the center as acalibration point Q′;

obtaining a light spot in the calibration image;

calculating the center of the light spot, and recording the center ofthe light spot as an imaging point Q, and recording the pixel distancefrom the imaging point Q to the image center of the calibration image asa reference distance q; calculating the relationship between the depthdistance z from the calibration point Q′ to the imaging system and thereference distance Δq, and recording it as:

$\begin{matrix}{{z = \frac{a}{{\Delta q} + b}}.} & (5)\end{matrix}$

In an embodiment, the step “calculating the relationship between thedepth distance z from the calibration point Q′ to the imaging system andthe reference distance Δq” comprises:

placing a camera of the imaging system in air or in liquid in thesimulated digestive tract, and measuring the depth distance z andreference distance Δq, and calculating by the equation 5 to obtain theparameter (a_(a), b_(a)) when the camera is in air, and to obtain theparameter (a_(b), b_(b)) when the camera in liquid in the simulateddigestive tract.

In an embodiment, in measurement stage, the step “calculating the depthdistance z_(i) from the target point P′ to the imaging systemseparately” comprises:

obtaining the reference distance Δp from the reference point P to theimage center of the detection image;

determining whether the detection image is taken in air or in digestiveliquid; when the detection image is taken in air, selecting theparameter (a_(a), b_(a)), and putting it together with the referencedistance Δp into the equation 5 to calculate the depth distance z_(i)from the target point P′ to the imaging system;

when the detection image is taken in digestive liquid, selecting theparameter (a_(b), b_(b)), and putting it together with the referencedistance Δp into the equation 5 to calculate the depth distance z_(i)from the target point P′ to the imaging system.

In one embodiment, the imaging system comprises a plurality of exposurelevels, and the calibration stage further comprises:

determining the relationship between the depth distance z from thecalibration point Q′ to the imaging system and the exposure levels; and

wherein the step “determining whether the detection image is taken inair or in digestive liquid” further comprises:

when 0<Δp<q₁, determining that the detection image is taken in air, andq₁ is the value of the air boundary point;

when q₁≤Δp≤q₂, comparing the exposure level of the detection image withthe exposure level in the calibration stage to determine whether thedetection image is taken in air or in digestive liquid, where q₂ is theidentifiable boundary point value;

when q₂<Δp, determining whether the detection image has mucus reflectionon the surface of the mucous membrane of digestive tract, and when thedetection image has mucus reflection, determining that the image istaken in air, and when the detection image does not have mucusreflection, determining that the image is taken in digestive liquid.

In an embodiment, the step “calculating the depth distance z_(i) fromthe target point P′ to the imaging system separately” comprises:

obtaining the time difference t between light emission and lightreception; calculating the depth distance z_(i) from the target point P′to the imaging system, and recording it as:z _(i)=½ct c  (6);

where, c represents light speed.

In an embodiment, the step “capturing and obtaining at least onedetection image” comprises:

controlling the imaging system to capture and obtain at least one image;

correcting the radial distortion of the captured image and forming adetection image, and recording it as:img_out(x,y)=img_in(x(1+l ₁ R ² +l ₂ R ⁴),y(1+l ₁ R ² +l ₂ R ⁴))  (7);

where, R=√{square root over (x²+y²)} represents the pixel distance fromthe pixel to the image center of the detection image, l₁ and l₂represent distortion parameters of the camera, x represents x-coordinateof the pixel, y represents y-coordinate of the pixel, img_in representsinput image, and img_out represents corrected image.

In an embodiment, the step “controlling the imaging system to captureand obtain at least one image” comprises:

controlling the imaging system to take a first captured image withreference point P;

controlling the imaging system to take a second captured image withoutreference point P;

determining the consistency of the first captured image and the secondcaptured image;

when it is determined that the first captured image and the secondcaptured image are inconsistent, taking images again;

when it is determined that the first captured image and the secondcaptured image are consistent, outputting both the first captured imageand the second captured image as captured image.

In an embodiment, the step “correcting the radial distortion of thecaptured image and forming a detection image” comprises:

correcting the radial distortion of the first captured image and forminga first detection image;

correcting the radial distortion of the second captured image andforming a second detection image; and

wherein the reference point P is obtained from the first detectionimage; the depth image z(x, y) is obtained after the second detectionimage is calibrated.

In an embodiment, the step “determining the consistency of the firstcaptured image and the second captured image” comprises:

adding a mask to the first captured image to completely cover the areaof the light spot;

adding a same mask to the second captured image;

comparing the first captured image and the second captured image afteradding the mask, and calculating the differentiation index MSE; wherein

when MSE≤T, the first captured image and the second captured image areconsidered to be consistent; and

when MSE≥T, the first captured image and the second captured image areconsidered to be inconsistent.

In an embodiment, the step “calculating the distance between any twopixels in the image or the area within any range” is followed by:

calculating a straight-line distance between any two pixels selected bya user from the detection image according to the three-dimensionalcoordinates of the two pixels; or,

building a three-dimensional image of any area according to thethree-dimensional coordinates of pixels in the area selected by a userfrom the detection image, and calculating a straight-line distancebetween any two pixels selected by the user from the three-dimensionalimage; or,

calculating the area of any area selected by a user from the detectionimage according to the three-dimensional coordinates of the area; or,

forming a scale on the detection image, and marking graduations on thescale as those of actual length; or,

identifying the lesion area in the detection image automatically, andcalculating the size or area of the area.

The present invention further provides a measuring system for objects indigestive tract based on an imaging system, comprising:

a size measurement module, configured to measure the depth distance zfrom an actual position of a pixel in a calibration image in simulateddigestive tract to the imaging system, and the scale r of any pixel inthe calibration image;

a brightness detection module, configured to identify the brightness ofany pixels in the calibration image or a detection image;

a calibration calculation module, configured to calculate therelationship between the brightness φ of any pixel in the calibrationimage and the depth distance z from the actual position of the pixel inthe simulated digestive tract to the imaging system, and record it asequation 1, and to calculate and determine the relationship between thescale r of any pixel in the calibration image and the depth distance zfrom the actual position of the pixel in the simulated digestive tractto the imaging system, and record it as equation 2;

a measurement and calculation module, configured to obtain the equation1 of the calibration calculation module and the pixel brightness in thebrightness detection module to calculate the depth image z(x, y) of thedetection image; and to obtain the equation 2 of the calibrationcalculation module and the depth image z(x, y) to calculate the actualtwo-dimensional coordinates S_(i)′ of each pixel in the detection image,and integrate to obtain the actual three-dimensional coordinates(S_(i)′, z(x, y)) of each pixel.

Compared to the prior art, in the method described above, therelationship between the brightness φ of any pixel in the calibrationimage and the depth distance z from the actual position of the pixel inthe simulated digestive tract to the imaging system, and therelationship between the scale r of any pixel in the calibration imageand the depth distance z from the actual position of the pixel in thesimulated digestive tract to the imaging system are obtained first inthe calibration stage. Then, in the actual measurement stage, thebrightness of each pixel point in the detection image can be obtained tocalculate the depth image z(x, y) by the equation 1; further, the scaler of each pixel point can be calculated; the actual two-dimensionalcoordinates Si′ of each pixel point in the detection image can beobtained through the scale r; further, the actual three-dimensionalcoordinates (Si′, z(x, y)) of each pixel point can be obtained byintegration. Therefore, through the above method, each imaging system orcapsule endoscope can be calibrated in the calibration stage, so thatdifferent parameters of the imaging system can be obtained in theprocess of calibration, and the parameters are needed for measurementand calculation in the subsequent process, so as to avoid errors due todifferences in equipment.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows an exemplary flowchart of the measurement method incalibration stage of the present invention;

FIG. 2 shows an exemplary flowchart of the measurement method inmeasurement stage of the present invention;

FIG. 3 is a schematic view showing the functional relationship betweenthe depth distance z from the target point P′ to the imaging system andthe reference distance ΔP from the reference point P to the center ofthe image according to the present invention.

FIG. 4 is a schematic view showing the depth distance z according to thepresent invention.

DETAILED DESCRIPTION

In order to enable those skilled in the art to better understand thetechnical solutions disclosed, the present invention can be described indetail below with reference to the accompanying drawings and preferredembodiments. However, the embodiments are not intended to limit theinvention, and obviously, the described embodiments are only a part ofthe embodiments of the present invention, but not all of them. All otherembodiments obtained by those having ordinary skill in the art withoutcreative work based on the embodiments of the present invention areincluded in the scope of the present invention.

Referring to FIGS. 1-4, the present invention provides a method formeasuring objects in digestive tract based on a imaging system, wherethe imaging system can be introduced into the digestive tract to takeimages of the objects therein, and a two-axis coordinate system ispreset on the images taken by the imaging system to determine thecoordinates of any pixel in the images. In the embodiment, the imagingsystem is a capsule endoscope. The capsule endoscope is usuallycapsule-shaped, and comprises a transparent front shell that encloses aninner board on which the imaging system is disposed, so that the imagingsystem can take images through the front shell.

In other embodiment, the object of the present invention can also beachieved if the imaging system is other equipment.

For ease of illustration, the following parameters are first described.A calibration point Q′ is a position on the photographed object in acalibration stage. An imaging point Q is the corresponding position ofthe calibration point Q′ on a calibration image in the calibrationstage. A target point P′ is a position on the photographed object in adetection stage. A reference point P is the corresponding position ofthe target point P′ on a detection image in the detection stage.

Specifically, the measurement method comprises the following steps:

simulating the environment of the digestive tract and entering thecalibration stage of the imaging system;

controlling the imaging system to photograph at different positions toobtain calibration images;

calculating and determining the relationship between the brightness φ ofany pixel in the calibration image and the depth distance z from theactual position of the pixel in the simulated digestive tract to theimaging system, and recording it as:z(x,y)=g(φ(x,y))  (1);

calculating and determining the relationship between the scale r of anypixel in the calibration image and the depth distance z from the actualposition of the pixel in the simulated digestive tract to the imagingsystem, where scale is the actual length represented by unit pixel inthe calibration image, and recording it as:r=dz  (2);

entering a measurement stage after calibration is completed;

placing the imaging system in the digestive tract;

capturing and obtaining at least one detection image;

obtaining the brightness of each pixel in the detection image;

calculating the depth distance z_(i) from each pixel in the detectionimage to the imaging system according to equation 1, and recording it asa depth image z(x, y);

calculating the scale r of each pixel in the detection image accordingto equation 2 and the depth image z(x, y);

obtaining the pixel coordinate S_(i) of each pixel point in thedetection image, and calculating the actual two-dimensional coordinateS_(i)′ of each pixel point in the detection image by the scale r;

integrating to obtain the actual three-dimensional coordinate (S_(i)′,z(x, y)) of each pixel;

calculating or measuring the distance between any two pixels in thedetection image or the area within any range.

In the method described above, the relationship between the brightness φof any pixel in the calibration image and the depth distance z from theactual position of the pixel in the simulated digestive tract to theimaging system, and the relationship between the scale r of any pixel inthe calibration image and the depth distance z from the actual positionof the pixel in the simulated digestive tract to the imaging system areobtained first in the calibration stage. Then, in the actual measurementstage, the brightness of each pixel point in the detection image can beobtained to calculate the depth image z(x, y) by the equation 1;further, the scale r of each pixel point can be calculated; the actualtwo-dimensional coordinates S_(i)′ of each pixel point in the detectionimage can be obtained through the scale r; further, the actualthree-dimensional coordinate (S_(i)′, z(x, y)) of each pixel point canbe obtained by integration. Therefore, through the above method, eachimaging system or capsule endoscope can be calibrated in the calibrationstage, so that different parameters of the imaging system can beobtained in the process of calibration, and the parameters are neededfor measurement and calculation in the subsequent process, so as toavoid errors due to differences in equipment.

The step “capturing and obtaining at least one detection image” furthercomprises: obtaining at least one reference point P in at least onedetection image, and recording the actual position of the referencepoint P in the digestive tract as a target point P′.

The step “calculating the depth distance z_(i) from each pixel in thedetection image to the imaging system according to equation 1” furthercomprises: calculating the pixel coordinate P_(i) of the reference pointP in the detection image separately;

calculating the depth distance z_(i) from the target point P′ to theimaging system separately;

obtaining the predicted brightness g⁻¹(z_(i)) of the reference point Pin the detection image according to equation 1 and the depth distancez_(i), where the function g⁻¹ is an inverse function of the function g;

comparing the predicted brightness g⁻¹(z_(i)) of the reference point Pwith the actual pixel brightness img(P_(i)) of the reference point P toobtain a correction factor k_(i), and recording it as:

$\begin{matrix}{{k_{i} = \frac{g^{- 1}\left( z_{i} \right)}{{img}\left( P_{i} \right)}};} & (3)\end{matrix}$

obtaining the mean value k of the correction factors k_(i) of allreference points P;

calibrating the pixels in the detection image with the mean value k ofcorrection factors to obtain the depth distance from each pixel to theimaging system, and recording it as the depth image z(x, y), where:z(x,y)=g( k img(x,y))  (4).

In the actual measurement stage, calculating the depth distance z_(i)from the target point P′ to the imaging system can measure the predictedbrightness g⁻¹(z_(i)) of the reference point P. Then, comparing thepredicted brightness g⁻¹(z_(i)) of the reference point P with the actualpixel brightness img(P_(i)) of the reference point P can obtain thecorrection factor k_(i). After obtaining the correction factor k_(i),calibrating all pixels in the detection image can obtain the brightnessof each pixel, so as to obtain the depth distance z(x, y) from eachpixel to the imaging system. Therefore, through the above method, thereference point P is obtained in the detection image, and then thecorrection factor is obtained from the predicted brightness and theactual brightness of the reference point P, so that all pixel points canbe corrected, making the measurement more accurate. The details can bedescribed below.

Specifically, the actual pixel brightness img(P_(i)) of the referencepoint P is the brightness of the pixel at point P in the detectionimage. Since the form of the function g can be related to the reflectioncoefficient of the object surface, exposure parameters, mediaenvironment, number of LEDs, distribution, camera lens performance andthe response of camera image sensor, although the relationship betweenthe brightness φ of any pixel in the calibration image and the depthdistance z from the actual position of the pixel in the simulateddigestive tract to the imaging system is obtained during the calibrationstage, when the actual distance z_(i) and the predicted brightnessg⁻¹(z_(i)) are obtained in subsequent process, it still needs to becompared with the actual pixel brightness of the reference point P toobtain a correction factor k_(i) to calibrate the actual brightness ofother pixels to obtain the depth distance z(x, y) of said other pixels.

In addition, in the final calculation process, two pixels or any areacan be selected manually or by a system, and then measured by thesystem; or, the system provides a scale, and the values are directlyread or measured manually.

In the embodiment, the reference point P is obtained by a laser device.The laser device emits a ray of light and forms a light spot on both theimage captured by the imaging system and the object being captured.Specifically, in th3 embodiment, a VCSEL chip is used, which can emit alaser light with a wavelength of 850 nm or 940 nm. The divergence angleof laser is very small, is mostly less than 6°, and the luminous poweris also very small, mostly is mostly less than 1 mW. The VCSEL chip anda camera are mounted together on the inner board of the capsuleendoscope to constitute an imaging system. The geometric relationshipbetween the VCSEL chip and the camera is also determined, and a laserlight spot can be formed on the captured image. At least one firstdistance measuring unit is set, the number of the first distancemeasuring units usually includes 1 to 4, and they are arranged aroundthe camera. Therefore, at least one laser light spot and the referencepoint P are also formed.

Referring to FIG. 4, in the embodiment, when the imaging system C istaking an image, the optical axis of the imaging system is through thecenter of the image, and the connecting line between the optical axisand the center of the image is recorded as a reference line. Therefore,the depth distance z from the target point P′ to the imaging system doesnot refer to a linear distance between the two, but refers to thedistance between the two in line with the direction of the referenceline, and the direction of the reference line is the z-axis direction.In addition, the image taken by the imaging system is preset with atwo-axis coordinate system recorded as a xoy plane coordinate system.The pixel coordinates S_(i) and the actual two-dimensional coordinatesS_(i)′ of each pixel are based on the xoy plane.

First of all, during calibration, the imaging system needs to be placedin a calibration box. The calibration box is a dark chamber and ensuresopacity to light. The calibration box comprises a fixing frame forfixing the imaging system, a target board for the imaging system to takeimages thereon, and the calibration box is also filled with a simulationmedium that can be simulated digestive liquid or air. The imaging systemcan move on the fixing frame. The imaging system further comprises aplurality of LEDs and a camera, where the LEDs and the camera are botharranged on the inner board of the capsule endoscope, and the number ofthe LEDs is set to be 2 to 5, and they are distributed around thecamera. The light field distribution of the LEDs can affect thedistribution of the brightness φ of any pixel in the calibration image,so each different imaging system must be calibrated separately.

Therefore, the imaging system can be set to take images at differentpositions, under different lighting conditions, in different simulationmedia and on different target boards to obtain the parameterinformation. The target board can also be replaced, such as a hard boardsimulating the mucosal surface or imitating the color of mucosa. Whenthe calibration box is used for other calibrations, only the targetboard needs to be replaced with a whiteboard, a chess board or a linepairs card, so that white balance correction, camera parametercalibration, resolution measurement and other calibrations can beperformed.

Moreover, during calibration, after each image is obtained, a radialdistortion correction for the image is required. This is because thecapturing of image can be affected by the distortion parameters ofdifferent cameras. Therefore, distortion correction can improve theaccuracy of size calculation of objects on the image, especially thesize measurement of objects at the edge of the image. The image withradial distortion correction can be calibrated to obtain parameterinformation. The specific information of radial distortion correctioncan be described in detail later.

In the measurement stage, as the correction factor is obtained, allpixels in the image can be calibrated and the depth distance z(x, y)from each pixel to the imaging system can be obtained. Due to differentphotographing environments of the imaging system and different positionsin the digestive tract, the correction factor can be affectedaccordingly. Specifically, the digestive tract has a plurality ofregions and the imaging system has a plurality of exposure levelsaccording to different photographing environments. So, after the step“obtaining the mean value k of the correction factors k_(i) of allreference points P”, the mean value k of the correction factors shouldbe stored according to different exposure levels and different digestivetract regions, and updated to a correction factor k. In the samedigestive tract region and with the same exposure parameters, thecorrection factors have small gap, so even if there is no referencepoint P, the depth distance z(x, y) from each pixel to the imagingsystem can also be obtained by the above equation 4. This method can notonly improve the anti-interference ability of the entire systemalgorithm, but also reduce the number of images taken with the referencepoint P, thus improving work efficiency.

If two or more correction factors are obtained at the same exposurelevel and in the same digestive tract region, the average of the meanvalues k of the correction factors should be calculated before storingand updating. Specifically, as shown in table 1, the digestive tractregions include esophagus, stomach, small intestine, large intestine,etc., the exposure levels include 1, 2 to N, and different exposurelevels and digestive tract regions are stored with different correctionfactor mean values k. If a new correction factor is added to the tablecorresponding to the esophagus and level 1 exposure, the originalcorrection factor and the new correction factor are averaged and theaverage value is stored in the original table. Therefore, if thereference point P is not obtained to calculate the correction factor k,the corresponding correction factor can also be selected for calculationfrom the table below according to the exposure level and digestive tractregion.

TABLE 1 Digestive tract regions Exposure levels Esophagus Stomach Smallintestine Large intestine 1 k11 k12 k13 k14 2 k21 k22 k23 k24 . . . . .. . . . . . . . . . N kN1 kN2 kN3 kN4

Secondly, as described above, the present invention introduces a laserVCSEL, then the step “obtaining at least one reference point P in atleast one detection image” comprises:

obtaining a light spot formed in a detection image;

calculating the center of the light spot, and recording the center ofthe light spot as a reference point P, and recording the pixel distancefrom the reference point P to the image center of the detection image asa reference distance Δp.

In the first embodiment of the present invention, the laser is directlyused to calculate the depth distance z from the target point P′ to theimaging system. The calibration stage further comprises:

obtaining a light spot in the simulated digestive tract;

calculating the center of the light spot and recording the center as acalibration point Q′;

obtaining a light spot in the calibration image;

calculating the center of the light spot, and recording the center ofthe light spot as an imaging point Q, and recording the pixel distancefrom the imaging point Q to the image center of the calibration image asa reference distance Δq.

Therefore, as shown in FIG. 1, in the calibration stage, since thegeometric relationship between the laser and the camera is determined,the relationship between the depth distance z from the calibration pointQ′ to the imaging system and the reference distance Δq from the imagingpoint Q to the image center of the calibration image can be calibrated.Specifically, the above relationship between the depth distance z fromthe calibration point Q′ to the imaging system and the referencedistance Δq is calculated by the following equation:

$\begin{matrix}{{z = \frac{a}{{\Delta q} + b}}.} & (5)\end{matrix}$

As described above, the environment in digestive tract is complex, forexample, the stomach and small intestine are usually water-filled, whilethe colon, especially from transverse colon to the descending colon, haslittle water content. The laser passes through the air in the capsule,penetrates the front shell of the capsule, and then enters the digestivetract. Due to the refraction of light, the laser light path can changesignificantly, resulting in changes in parameters a and b in equation 5.Therefore, specifically, in the calibration stage, the step “calculatingthe relationship between the depth distance z from the calibration pointQ′ to the imaging system and the reference distance Δq” comprises:placing the camera in air or in liquid in the simulated digestive tract,and measuring the depth distance z from the calibration point Q′ to theimaging system and reference distance Δq from the imaging point Q to theimage center of the calibration image, and calculating by the equation 5to obtain the parameter (a_(a), b_(a)) when the camera is in air and theparameter (a_(b), b_(b)) when the camera in liquid in the simulateddigestive tract.

Therefore, in the measurement stage, the step “calculating the depthdistance z_(i) from the target point P′ to the imaging systemseparately” can also be affected by the environment of the digestivetract. Specifically, the above step comprises:

obtaining the reference distance Δp from the reference point P to theimage center of the detection image;

determining whether the detection image is taken in air or in digestiveliquid; when the detection image is taken in air, selecting theparameter (a_(a), b_(a)), and putting it together with the abovereference distance Δp into the equation 5 to calculate the depthdistance z_(i) from the target point P′ to the imaging system; when thedetection image is taken in digestive liquid, selecting the parameter(a_(b), b_(b)), and putting it together with the above referencedistance Δp into the equation 5 to calculate the depth distance z_(i)from the target point P′ to the imaging system. Therefore, the depthdistance z_(i) from the target point P′ to the imaging system can beobtained.

According to the above, “determining whether the detection image istaken in air or in digestive liquid” is particularly important. However,the exposure levels should be introduced for determination. Therefore,in the calibration stage, it is also needed to determine therelationship between the depth distance z from the calibration point Q′to the imaging system and the exposure levels. Referring to FIG. 1, theprocess in the dashed box 406 is an additional calibration process whenthe first distance measuring unit is used. When the first distancemeasuring unit is not used, the process in the dashed box 406 may beomitted.

Specifically, as shown in FIG. 3, the depth distance z from the targetpoint P′ to the imaging system and the reference distance Δp from thereference point P to the image center of the detection image have acertain functional relationship, where curve 401 represents therelationship when the environment is digestive liquid, and the curve 402represents the relationship when the environment is air.

Therefore, according to FIG. 3, the above determination processcomprises:

when 0<Δp<q₁, it is determined that the detection image is taken in air,where q₁ is the separation point between 403 and 404, i.e the airboundary point. When Δp can be within this range, the detection imagemust be taken in air.

When q₁<Δp<q₂, within this range, the exposure levels for taking imagein air and in digestive liquid have significant difference. At thispoint, putting Δp and (a_(a), b_(a)) and (a_(b), b_(b)) into theequation 5 to obtain different z_(i) values, then determining twoexposure levels according to the relationship between the depth distancez and the exposure levels in the calibration stage, and finallycomparing them with the actual exposure levels of the detection image todetermine whether the detection image is taken in air or simulateddigestive liquid; in particular, when the z_(i) value of one of the twoexposure levels is exactly twice that of the other, Δp=q₂, and q₂ is theseparation point between 404 and 405, that is the identifiable boundarypoint value.

When q₂<Δp, determining whether the detection image has mucus reflectionon the surface of the mucous membrane of digestive tract, and when thedetection image has mucus reflection, determining that the image istaken in air, and when the detection image does not have mucusreflection, determining that the image is taken in digestive liquid.

Therefore, in the first embodiment, the relationship between the depthdistance z from the calibration point Q′ to the imaging system and thepixel distance Δq from the imaging point Q to the image center of thecalibration image, and the relationship between the depth distance zfrom the reference point to the imaging system and the exposure levelsare required to be calibrated in advance in the calibration stage. Thenin the measurement stage, after obtaining the detection image, firstobtaining the coordinates P_(i) of the reference point P, and thenobtaining the reference distance Δp from the reference point P to theimage center of the detection image, and then determining whether thedetection image is taken in air or in digestive liquid; afterdetermining and obtaining the exact parameters (a_(a), b_(a)) or (a_(b),b_(b)), the depth distance z_(i) from the target point P′ in thedetection image to the imaging system can be obtained by equation 5.

In the second embodiment of the present invention, the step “calculatingthe depth distance z_(i) from the target point P′ to the imaging systemseparately” comprises:

obtaining the time difference t between light emission and lightreception; calculating the depth distance z_(i) from the target point P′to the imaging system, and recording it as:z _(i)=½ct  (6);

where, c represents light speed.

In the embodiment, the imaging system comprises a distance measuringunit that emits light, and the light can be reflected by an obstaclewhen encountered and received by the distance measuring unit. Thedistance measuring unit is a time of flight (ToF) chip, and the distancemeasuring unit can obtain the depth distance z_(i) from the target pointP′ to the imaging system directly by the time difference t between lightemission and light reception.

Light travels fast in both digestive liquid and air, so the gap causedby the medium in digestive tract is negligible. In the embodiment, a ToFchip is used as the distance measuring unit. Although the ToF chip candirectly obtain the depth distance z_(i) from the target point P′ to theimaging system by a relatively simple calculation, the ToF chip is alsobig in size, so use of the ToF chip in capsule endoscope, such aminiaturized device, is limited.

Moreover, usually, the ToF chip also needs the laser device, i.e VCSELchip as a light source to form a light spot on the detection image, thatis, the laser device is needed to obtain the pixel coordinates P_(i) ofthe reference point P in the detection image, and the depth distancez_(i) from the target point P′ to the imaging system can be measured bya second distance measuring unit. In the second embodiment, similarly,the number of the distance measuring units is set as at least 1, usuallyincluding 1 to 4, and they are arranged around the camera. Therefore, atleast one reference point P is also formed.

Therefore, according to the above, after obtaining the depth distancez_(i) from a plurality of reference points P and their actual targetpoints P′ to the imaging system, the actual two-dimensional coordinatesS_(i)′ of each pixel in an xoy plane can be obtained through subsequentcalculation of correction factors, scale, etc., and the actualthree-dimensional coordinates (S_(i)′, z(x, y)) of each pixel can beobtained by integrating the corresponding depth distance z(x, y).

As described above, during calibration, to ensure image accuracy, aftereach image is obtained, a radial distortion correction for the image isrequired. Therefore, in the specific implementation process of thepresent invention, a radial distortion correction is also required forthe captured images. Specifically, the step “capturing and obtaining atleast one detection image” comprises:

controlling the imaging system to capture and obtain at least one image;correcting the radial distortion of the captured image and forming adetection image, and recording it as:img_out(x,y)=img_in(x(1+l ₁ R ² +l ₂ R ⁴),y(1+l ₁ R ² +l ₂ R ⁴))c  (7);

where, R=√{square root over (x²+y²)} represents the pixel distance fromthe pixel to the image center of the detection image, l₁ and l₂represent distortion parameters of the camera, x represents x-coordinateof the pixel, y represents y-coordinate of the pixel, img_in representsinput image, and img_out represents corrected image.

In addition, due to the complex photographing environment, it is verylikely that waste films can be produced in the photographing process.Therefore, the captured images should be checked as described below.

Specifically, the step “controlling the imaging system to capture andobtain at least one image” comprises:

controlling the imaging system to take a first captured image withreference point P;

controlling the imaging system to take a second captured image withoutreference point P;

determining the consistency of the first captured image and the secondcaptured image;

when it is determined that the first captured image and the secondcaptured image are inconsistent, taking images again;

when it is determined that the first captured image and the secondcaptured image are consistent, outputting both the first captured imageand the second captured image as captured image;

where, in the actual measurement stage, after entering digestive tract,the imaging system can continuously take two frames of images each time,with an interval of usually less than 40 ms, so the scenes correspondingto the two captured images have only minor change. In addition, thefirst captured image has a reference point P, so the first capturedimage is captured with the first or second distance measuring unitturned on, and therefore a light spot is visible; the second capturedimage is captured with the first distance measuring unit and the seconddistance measuring unit turned off, so the reference point P does notexist.

Although the scenes corresponding to the first captured image and thesecond captured image have only minor changes in theory, considering thecomplex movement conditions in digestive tract, the consistency judgmentdescribed above is required.

Specifically, the step “determining the consistency of the firstcaptured image and the second captured image” comprises:

adding a mask to the first captured image to completely cover the areaof the light spot;

adding a same mask to the second captured image;

comparing the first captured image and the second captured image afteradding the mask, and calculating the differentiation index MSE;

when MSE≤T, the first captured image and the second captured image areconsidered to be consistent;

when MSE≥T, the first captured image and the second captured image areconsidered to be inconsistent.

Specifically, how to calculate the differentiation index is not repeatedhere, and T is a threshold obtained in advance from a plurality ofexperiments.

In this step, if it is determined that the first captured image and thesecond captured image are consistent, outputting both the first capturedimage and the second captured image as captured image. Therefore, in theabove radial distortion correction stage, the step “correcting theradial distortion of the captured image and forming a detection image”comprises:

correcting the radial distortion of the first captured image and forminga first detection image;

correcting the radial distortion of the second captured image andforming a second detection image;

where, since a light spot is formed in the first detection image, thepixel coordinates P_(i) of the reference point P can be obtained by“circle fitting method”. Since there is no light spot in the seconddetection image, lesion information can be completely displayed, so thedepth image z(x, y) can be obtained from the second detection imageafter calibration.

In addition, it is also possible to control the system program tocapture only one captured image. At this point, a light spot can also bedisplayed on the captured image, and subsequent operations can also beperformed. However, in this embodiment, by determining the consistencyof the first captured image and the second captured image, the accuracyof the detection image and its subsequent calculation can be improved.

Finally, after obtaining the depth image z(x, y) and the actualcoordinates S_(i)′ of each pixel in the xoy plane, they can beintegrated to obtain the actual three-dimensional coordinates (S_(i)′,z(x, y)) of each pixel. Therefore, after the step of “calculating ormeasuring the distance between any two pixels in the detection image orthe area within any range”, the calculation can be performed accordingto different user interaction modes, and if two detection images areobtained, the user interaction is based on the second detection image.

Specifically, in a first interaction mode, a straight-line distancebetween any two pixels selected by a user from the detection image canbe calculated according to the three-dimensional coordinates of the twopixels.

Or, in a second interaction mode, a three-dimensional image of any areacan be built according to the three-dimensional coordinates of pixels inthe area selected by a user from the detection image, and astraight-line distance between any two pixels selected by the user fromthe three-dimensional image can be calculated.

Or, in a third interaction mode, the area of any area selected by anuser from the detection image can be calculated according to thethree-dimensional coordinates of the area.

Or, in a fourth interaction mode, a scale is formed on the detectionimage, and the graduations on the scale are marked as those of actuallength, users can place the scale at different positions, and thegraduations of the scale at different positions are also different, thenusers can read and measure by themselves.

Or, in a fifth interaction mode, the lesion area in the detection imagecan be automatically identified, with the size or area of the areacalculated.

The above step “calculating the distance between any two pixels in theimage or the area within any range” is not limited to have only the fiveinteraction modes, but the calculation method is based on that theactual three-dimensional coordinates of each pixel have been obtained,so other interaction modes if any are also within the protection scopeof the present invention.

Therefore, the present invention further provides a measuring system forobjects in the digestive tract based on an imaging system, comprising:

a size measurement module, configured to measure the depth distance zfrom the actual position of a pixel in the calibration image in thesimulated digestive tract to the imaging system, and the scale r of anypixel in the calibration image; a brightness detection module,configured to identify the brightness of any pixels in the calibrationimage or detection image;

a calibration calculation module, configured to calculate therelationship between the brightness φ of any pixel in the calibrationimage and the depth distance z from the actual position of the pixel inthe simulated digestive tract to the imaging system, and record it asequation 1, and to calculate and determine the relationship between thescale r of any pixel in the calibration image and the depth distance zfrom the actual position of the pixel in the simulated digestive tractto the imaging system, and record it as equation 2;

a measurement and calculation module, configured to obtain the equation1 of the calibration calculation module and the pixel brightness in thebrightness detection module to calculate the depth image z(x, y) of thedetection image; and to obtain the equation 2 of the calibrationcalculation module and the depth image z(x, y) to calculate the actualtwo-dimensional coordinates S_(i)′ of each pixel in the detection image,and integrate to obtain the actual three-dimensional coordinates(S_(i)′, z(x, y)) of each pixel.

In summary, the method for measuring objects in the digestive tractbased on the imaging system in the present invention can obtain someparameter information in advance through the calibration stage of theimaging system, and thereby facilitate the calculation in themeasurement stage and avoid calculation error caused by equipmentdifference between imaging systems. Secondly, by the storage ofcorrection factors k, after the storage amount of k is getting largerand the value of k is getting more stable, the correction factor k maynot be calculated in the subsequent photographing process, so the use oflaser device and distance measuring unit can be reduced. Finally, when alaser device is used, through separate measurement in differentdigestive tract environments in the calibration stage, the scenes in thedigestive tract, air or digestive liquid, can also be determined in themeasurement stage, so that different processing methods can be selectedto improve accuracy.

It should be understood that, although the specification is described interms of embodiments, not every embodiment merely comprises anindependent technical solution. Those skilled in the art should have thespecification as a whole, and the technical solutions in each embodimentmay also be combined as appropriate to form other embodiments that canbe understood by those skilled in the art.

The present invention by no means is limited to the preferredembodiments described above. On the contrary, many modifications andvariations are possible within the scope of the appended claims.

What is claimed is:
 1. A method for measuring objects in digestive tract based on an imaging system, comprising: simulating an environment of the digestive tract and entering a calibration stage of the imaging system; controlling the imaging system to photograph at different positions to obtain a calibration image; calculating and determining the relationship between the brightness φ of any pixel in the calibration image and the depth distance z from the actual position of the pixel in the simulated digestive tract to the imaging system, and recording it as: z(x,y)=g(φ(x,y))  (1); calculating and determining the relationship between the scale r of any pixel in the calibration image and the depth distance z from the actual position of the pixel in the simulated digestive tract to the imaging system, wherein scale is the actual length represented by unit pixel in the calibration image, and recording it as: r=dz  (2); wherein d is a parameter having a constant value determined by lens and image sensor at use in the imaging system, entering a measurement stage after calibration is completed; placing the imaging system in the digestive tract; capturing and obtaining at least one detection image; obtaining the brightness of each pixel in the detection image; calculating the depth distance z_(i) from each pixel in the detection image to the imaging system according to equation 1, and recording it as a depth image z(x, y); calculating the scale r of each pixel in the detection image according to equation 2 and the depth image z(x, y); obtaining the pixel coordinates S_(i) of each pixel point in the detection image, and calculating the actual two-dimensional coordinates S_(i)′ of each pixel point in the detection image by the scale r; integrating to obtain the actual three-dimensional coordinates (S_(i)′, z(x, y)) of each pixel; calculating or measuring the distance between any two pixels in the detection image or the area within any range, wherein the step “capturing and obtaining at least one detection image” further comprises: obtaining at least one reference point P in at least one detection image, and recording the actual position of the reference point P in the digestive tract as a target point P′; and wherein the step “calculating the depth distance z_(i) from each pixel in the detection image to the imaging system according to equation 1” further comprises: calculating the pixel coordinates P_(i) of the reference point P separately; calculating the depth distance z_(i) from the target point P′ to the imaging system separately; obtaining the predicted brightness g⁻¹(z_(i)) of the reference point P in the detection image according to equation 1 and the depth distance z_(i); comparing the predicted brightness g⁻¹(z_(i)) of the reference point P with the actual pixel brightness img(P_(i)) of the reference point P to obtain a correction factor k_(i), and recording it as: $\begin{matrix} {{k_{i} = \frac{g^{- 1}\left( z_{i} \right)}{{img}\left( P_{i} \right)}};} & (3) \end{matrix}$ obtaining the mean value k of the correction factors k_(i) of all reference points P; calibrating the pixels in the detection image with the mean value k of correction factors to obtain the depth distance from each pixel to the imaging system, and recording it as the depth image z(x, y), where: z(x,y)=g( kimg(x,y))  (4); wherein the step “obtaining at least one reference point P in at least one detection image” comprises: obtaining a light spot formed in a detection image; calculating the center of the light spot, and recording the center of the light spot as a reference point P, and recording the pixel distance from the reference point P to the image center of the detection image as a reference distance Δp.
 2. The method of claim 1, wherein the digestive tract comprises a plurality of regions and the imaging system comprises a plurality of exposure levels; and wherein, after the step “obtaining the mean value k of the correction factors k_(i) of all reference points P”, the mean value k of the correction factors is stored according to different exposure levels and different digestive tract regions.
 3. The method of claim 2, wherein after two or more mean values k of correction factors are obtained at the same exposure level and digestive tract region, calculating the average of the mean values k of correction factors before storing and updating.
 4. The method of claim 1, wherein the calibration stage further comprises: obtaining a light spot in the simulated digestive tract; calculating the center of the light spot and recording the center as a calibration point Q′; obtaining a light spot in the calibration image; calculating the center of the light spot, and recording the center of the light spot as an imaging point Q, and recording the pixel distance from the imaging point Q to the image center of the calibration image as a reference distance Δq; calculating the relationship between the depth distance z from the calibration point Q′ to the imaging system and the reference distance Δq, and recording it as: $\begin{matrix} {{z = \frac{a}{{\Delta q} + b}}.} & (5) \end{matrix}$
 5. The method of claim 4, wherein the step “calculating the relationship between the depth distance z from the calibration point Q′ to the imaging system and the reference distance Δq” comprises: placing a camera of the imaging system in air or in liquid in the simulated digestive tract, and measuring the depth distance z and reference distance Δq, and calculating by the equation 5 to obtain the parameter (a_(a), b_(a)) when the camera is in air, and to obtain the parameter (a_(b), b_(b)) when the camera in liquid in the simulated digestive tract.
 6. The method of claim 5, wherein in the measurement stage, the step “calculating the depth distance z_(i) from the target point P′ to the imaging system separately” comprises: obtaining the reference distance Δp from the reference point P to the image center of the detection image; determining whether the detection image is taken in air or in digestive liquid; when the detection image is taken in air, selecting the parameter (a_(a), b_(a)), and putting it together with the reference distance Δp into the equation 5 to calculate the depth distance z_(i) from the target point P′ to the imaging system; when the detection image is taken in digestive liquid, selecting the parameter (a_(b), b_(b)), and putting it together with the reference distance Δp into the equation 5 to calculate the depth distance z_(i), from the target point P′ to the imaging system.
 7. The method of claim 6, wherein the imaging system comprises a plurality of exposure levels, and the calibration stage further comprises: determining the relationship between the depth distance z from the calibration point Q′ to the imaging system and the exposure levels; and wherein the step “determining whether the detection image is taken in air or in digestive liquid” further comprises: when 0<Δp<q₁, determining that the detection image is taken in air, and q₁ is the value of the air boundary point; when q₁≤Δp≤q₂, comparing the exposure level of the detection image with the exposure level in the calibration stage to determine whether the detection image is taken in air or in digestive liquid, where q₂ is the identifiable boundary point value; when q₂<Δp, determining whether the detection image has mucus reflection on the surface of the mucous membrane of digestive tract, and when the detection image has mucus reflection, determining that the image is taken in air, and when the detection image does not have mucus reflection, determining that the image is taken in digestive liquid.
 8. The method of claim 1, wherein the step “calculating the depth distance z_(i), from the target point P′ to the imaging system separately” comprises: obtaining the time difference t between light emission and light reception; calculating the depth distance z_(i), from the target point P′ to the imaging system, and recording it as: z _(i)=½ct c  (6); where, c represents light speed.
 9. The method of claim 1, wherein the step “capturing and obtaining at least one detection image” comprises: controlling the imaging system to capture and obtain at least one image; correcting the radial distortion of the captured image and forming a detection image, and recording it as: img_out(x,y)=img_in(x(1+l ₁ R ² +l ₂ R ⁴),y(1+l ₁ R ² +l ₂ R ⁴))  (7); where, R=√{square root over (x²+y²)} represents the pixel distance from the pixel to the image center of the detection image, l₁ and l₂ represent distortion parameters of the camera, x represents x-coordinate of the pixel, y represents y-coordinate of the pixel, img_in represents input image, and img_out represents corrected image.
 10. The method of claim 9, wherein the step “controlling the imaging system to capture and obtain at least one image” comprises: controlling the imaging system to take a first captured image with reference point P; controlling the imaging system to take a second captured image without reference point P; determining the consistency of the first captured image and the second captured image; when it is determined that the first captured image and the second captured image are inconsistent, taking images again; when it is determined that the first captured image and the second captured image are consistent, outputting both the first captured image and the second captured image as captured image.
 11. The method of claim 10, wherein the step “correcting the radial distortion of the captured image and forming a detection image” comprises: correcting the radial distortion of the first captured image and forming a first detection image; correcting the radial distortion of the second captured image and forming a second detection image; and wherein the reference point P is obtained from the first detection image; the depth image z(x, y) is obtained after the second detection image is calibrated.
 12. The method of claim 10, wherein the step “determining the consistency of the first captured image and the second captured image” comprises: adding a mask to the first captured image to completely cover the area of the light spot; adding a same mask to the second captured image; comparing the first captured image and the second captured image after adding the mask, and calculating the differentiation index MSE; wherein when MSE≤T, the first captured image and the second captured image are considered to be consistent; and when MSE>T, the first captured image and the second captured image are considered to be inconsistent.
 13. The method of claim 1, wherein the step “calculating the distance between any two pixels in the detection image or the area within any range” is followed by: calculating a straight-line distance between any two pixels selected by a user from the detection image according to the three-dimensional coordinates of the two pixels; or, building a three-dimensional image of any area according to the three-dimensional coordinates of pixels in the area selected by a user from the detection image, and calculating a straight-line distance between any two pixels selected by the user from the three-dimensional image; or, calculating the area of any area selected by a user from the detection image according to the three-dimensional coordinates of the area; or, forming a scale on the detection image, and marking graduations on the scale as those of actual length; or, identifying a lesion area in the detection image automatically, and calculating the size or area of the area.
 14. A measuring system for objects in digestive tract based on an imaging system, comprising: one or more computer processors configured to: measure the depth distance z from an actual position of a pixel in a calibration image in simulated digestive tract to the imaging system, and the scale r of any pixel in the calibration image; identify the brightness of any pixels in the calibration image or a detection image; calculate the relationship between the brightness φ of any pixel in the calibration image and the depth distance z from the actual position of the pixel in the simulated digestive tract to the imaging system, and record it as equation 1, z(x,y)=g(φ(x,y))  (1); and calculate and determine the relationship between the scale r of any pixel in the calibration image and the depth distance z from the actual position of the pixel in the simulated digestive tract to the imaging system, and record it as equation 2, r=dz  (2); wherein d is a parameter having a constant value determined by lens and image sensor at use in the imaging system, obtain the equation 1 of the calibration calculation module and the pixel brightness in the brightness detection module to calculate the depth image z(x, y) of the detection image; and to obtain the equation 2 of the calibration calculation module and the depth image z(x, y) to calculate the actual two-dimensional coordinates S_(i)′ of each pixel in the detection image, and integrate to obtain the actual three-dimensional coordinates (S_(i)′, z(x, y)) of each pixel, wherein the step “identify the brightness of any pixels in the calibration image or a detection image” further comprises: obtaining at least one reference point P in at least one detection image, and recording the actual position of the reference point P in the digestive tract as a target point P′; and wherein the step “calculate the relationship between the brightness φ of any pixel in the calibration image and the depth distance z from the actual position of the pixel in the simulated digestive tract to the imaging system, and record it as equation 1” further comprises: calculating the pixel coordinates P_(i) of the reference point P separately; calculating the depth distance z_(i) from the target point P′ to the imaging system separately; obtaining the predicted brightness g⁻¹(z_(i)) of the reference point P in the detection image according to equation 1 and the depth distance z_(i); comparing the predicted brightness g⁻¹(z_(i)) of the reference point P with the actual pixel brightness img(P_(i)) of the reference point P to obtain a correction factor k_(i), and recording it as: $\begin{matrix} {{k_{i} = \frac{g^{- 1}\left( z_{i} \right)}{{img}\left( P_{i} \right)}};} & (3) \end{matrix}$ obtaining the mean value k of the correction factors k_(i), of all reference points P; calibrating the pixels in the detection image with the mean value k of correction factors to obtain the depth distance from each pixel to the imaging system, and recording it as the depth image z(x, y), where: z(x,y)=g( kimg(x,y))  (4); wherein the step “obtaining at least one reference point P in at least one detection image” comprises: obtaining a light spot formed in a detection image; calculating the center of the light spot, and recording the center of the light spot as a reference point P, and recording the pixel distance from the reference point P to the image center of the detection image as a reference distance Δp. 